package com.example.myspringboot.business;

import org.springframework.stereotype.Service;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

@Service
public class PdfService {

    public byte[] getPdf() throws IOException {
        String fileUrl = "E:\\AllFiles\\tips.pdf";
        File file = new File(fileUrl);
        FileInputStream fileInputStream = new FileInputStream(file);
        byte[] buffer = new byte[(int) file.length()];
        int count = 0;
        while (count != -1) {
            count = fileInputStream.read(buffer);
        }
        fileInputStream.close();
        return buffer;
    }
}
